Efficient distribution and selection of storage media in a storage medium library

ABSTRACT

A location of a first drive in a storage medium library is determined. In response to a determination of the location of the first drive, it is determined whether a first storage medium is located within a first distance from the first drive. In response to a determination that the first storage medium is not located within the first distance from the first drive, it is determined whether the first storage medium is located within a second distance from the first drive. In response to a determination that the first storage medium is located within the first distance or the second distance from the first drive, the first storage medium is made available to be read by or written to by the first drive.

RELATED APPLICATIONS

This application is a continuation of, and claims the priority benefitof, U.S. application Ser. No. 14/513,401 filed Oct. 14, 2014. which is acontinuation of, and claims priority benefit of, U.S. patent applicationSer. No. 13/767,370, filed Feb. 14, 2013, which is a continuation of,and claims the benefit of, U.S. patent application Ser. No. 13/683,433,filed Nov. 21, 2012.

BACKGROUND

Embodiments of the inventive subject matter generally relate to thefield of mass storage systems, and, more particularly, to the efficientmovement of storage media in a storage medium library.

Mass storage systems are utilized in scenarios where large amounts ofdata are handled, such as data centers. Although many of these massstorage systems utilize a large number of individual storage media andare designed to function with little human intervention, movement ofstorage media within these systems can be slow and inefficient. Reducingthe amount of time taken to move storage media can reduce the amount oftime a particular software program is idle waiting for the movement tocomplete, and reducing the amount of movement can positively impact thecost of electricity.

SUMMARY

Embodiments of the inventive subject matter include a method in whichthe location of a drive in a storage medium library is determined.Responsive to said determination, it is determined whether a storagemedium that is available to be read from or written to is located withinfirst distance from the drive. If it is determined that the storagemedium is not located within the first distance from the drive, it isdetermined whether the first storage medium is located within a seconddistance from the first drive. The second distance is farther than thefirst distance. If it is determined that the storage medium is locatedwithin the first or second distance from the drive, the storage mediumis made available to be read by or written to by the first drive.

BRIEF DESCRIPTION OF THE DRAWINGS

The present embodiments may be better understood, and numerous objects,features, and advantages made apparent to those skilled in the art byreferencing the accompanying drawings.

FIG. 1 depicts the interactions between a library manager and a shuttlecomplex to distribute scratch cartridges within the tape library.

FIG. 2 depicts a first flowchart of example operations a library managercan perform to distribute scratch cartridges to a set of interconnectedlibrary strings in a tape library.

FIG. 3 depicts a second flowchart of example operations a librarymanager can perform to distribute scratch cartridges to a set ofinterconnected library strings in a tape library.

FIG. 4 depicts a tape library system that is designed to efficientlyfind an available tape drive and scratch cartridge, minimizing thedistance traveled by a scratch cartridge.

FIG. 5 depicts a flowchart of example operations a library manager canperform to find an available tape drive and scratch cartridge.

FIG. 6 depicts a tape library system that is designed to distributescratch cartridges in conjunction with the servicing of other requests.

FIG. 7 depicts a flowchart of example operations a library manager canperform to distribute scratch cartridges while servicing other requests.

FIG. 8 depicts an example computing system with a library manager.

DESCRIPTION OF EMBODIMENT(S)

The description that follows includes exemplary systems, methods,techniques, instruction sequences and computer program products thatembody techniques of the present inventive subject matter. However, itis understood that the described embodiments may be practiced withoutthese specific details. For instance, although examples refer to tapelibraries, the inventive subject matter is not so limited, and can alsoapply to other mass storage systems. In other instances, well-knowninstruction instances, protocols, structures and techniques have notbeen shown in detail in order not to obfuscate the description.

Mass storage systems can take many forms. One common form is an array ofhard drives. These are particularly useful when access to allinformation at once is beneficial. Another type, referred to as astorage library or storage medium library, contains a large number ofremovable storage media, and a number of drives that can read and writeto this removable media. The storage medium library is particularlyuseful when large amounts of data need to be stored but not accessed asfrequently. Tape libraries and tape cartridges are examples of storagemedium libraries and storage media, respectively. Because it is easierto understand the concepts embodied in the inventive subject matter ifdiscussed in the context of a specific type of storage medium library,tape libraries and tape cartridges will be used hereinafter. Theinventive subject matter is not so restricted, and can apply to anystorage medium library.

Tape library technology has been developed that allows for easyexpansion and automated functionality. For example, individual tapelibrary systems are called library frames. These systems are large,single systems that contain one or more tape drives, tape cartridges,storage for tape cartridges (hereinafter referred to as cartridges), anda robotic arm or other mechanism that can move the cartridges from theirstorage location and insert them into an unused tape drive, or viceversa. The library frames may contain a different number of tape drivesand cartridges. For example, one may contain five tape drives, and fiftycartridges. This is possible because not all cartridges are in use atonce, but rather spend most of the time stored. It is possible that onlya small fraction of cartridges are being used at one time.

Library frames can be connected side-by-side to form library strings.The tape frames have a door or open space on each side that allows a carto move between the individual library frames. Thus, if five libraryframes are arranged into a library string, the first library frame canuse its robotic arm to put the tape into the car. The car can thentravel to the fifth library string, which can then use its robotic armto remove the cartridge and insert it into a tape drive or storagelocation. Library strings can also be connected to form shuttlecomplexes by means of shuttle connections. A shuttle connection connectsto at least two library strings arranged in rows and allows a car totravel between library strings, similar to how the car travels betweenlibrary frames. The term “tape library” will hereinafter by used torefer to shuttle complexes unless a specific distinction is to be made.

Cartridges can exist in at least two states. The first is a cartridgethat is available to be written to by any requesting software program.These available cartridges, hereinafter referred to as “scratchcartridges,” can be new cartridges that have not been written to sincebeing added to the tape library or cartridges that were previouslywritten to by software programs but are no longer needed. The second isa cartridge that is assigned to a particular software program. Thesecartridges, hereinafter referred to as “assigned cartridges,” have beenwritten to by a particular software program, and may be read from at afuture point. The assigned cartridges are restricted to use by thesoftware program to which they are assigned.

Tape libraries can be managed by software designed to abstract the tapelibrary operations from the software that reads and writes to thecartridges. The software or system that manages the tape library isreferred to as a “library manager.” The library manager can exist as acomponent of the tape library or outside of the tape library, butconnected in a manner that allows communication between the tape libraryand the library manager. When the term “tape library” is usedhereinafter, it includes the library manager. When referring to thelibrary manager communicating with the tape library, the library manageris communicating with other components within the tape library, and isnot being described as a separate entity.

The library manager can provide an interface for other software thatmakes using the tape library simpler than it would be if the softwareinterfaced directly with the tape library. For example, instead ofsearching through all the individual cartridges and drives to find onesthat are available, the software requests a file handle from the librarymanager. The library manager then finds an appropriate cartridge anddrive, instructs the tape library to mount the cartridge in the drive,and provides a file handle that, when written to, writes the data to theappropriate drive.

The average time taken to move a cartridge from a source location to atarget location within a library string can be less than ten seconds.The average time taken to move a cartridge from a source location in onelibrary string to a target location in an adjacent library string can benearly forty seconds. The average time taken increases with furtherexpansion. Thus, a program requesting use of a cartridge may wait fornearly forty seconds if a cartridge is located one library string awayfrom an available drive.

Time spent waiting for a cartridge to be mounted into a tape drive istime that cannot be spent processing data or accomplishing a task. Thetape library may not be able to fulfill other requests while it movescartridges around, further compounding the problem. Furthermore,electricity makes up one of the largest costs for large data centers,thus, optimizing existing solutions by reducing the amount ofelectricity used can have an impact on the electricity costs. The moremovement involved in operating a tape library, the more electricity isused. Thus, reducing both the amount of time spent waiting for a requestand the amount of electricity used can be important goals forinstallations that utilize a tape library.

Various metrics can be used to measure the performance of a tapelibrary. For example, the amount of time a software program waits for arequest to be serviced by the tape library can be used, as discussedabove. This can be combined with data throughput rates and other aspectsto determine the total length of time taken to service the request. Alsoas discussed above, the amount and cost of electricity use can be auseful metric. Indirect measurements of these can be used as well. Forexample, tracking the distance cartridges travel while servicingrequests can serve to measure the efficiency of the tape library becausethe longer the distance traveled, generally, the longer it takes.Similarly, the more movement required, generally, the more electricityrequired. Thus, a reduction in total movement can bring about faster,more efficient operation as well as lower overhead.

Additionally, it may be a goal for a tape library to move variouscomponents around when no requests are pending. For example, if asoftware program makes a request for a cartridge, any time spent movingthat cartridge before making it available is time that the softwareprogram is waiting. If no requests are pending, the tape library canmove that cartridge closer to an available tape drive, reducing theamount of travel in response to a request, and thus reducing the amountof time the software program waits. In other words, if a tape librarycan anticipate movement of a cartridge prior to an actual request, thetape library can reduce the amount of time a software program waits bymoving the cartridge when no request is pending.

A tape library can be designed to increase the efficiency of locatingand moving a scratch cartridge to a drive that has been selected foruse. By distributing the scratch cartridges in accordance with certaindistributions, the tape library reduces the distance a scratch cartridgetravels to get to an available drive when requested by a softwareprogram. Reducing the distance traveled by a scratch cartridge toservice a software program request reduces the amount of time thesoftware program waits.

FIG. 1 depicts the interactions between a library manager and a shuttlecomplex to distribute scratch cartridges within the tape library. FIG. 1includes a tape library system 100, including a library manager 102 anda shuttle complex 110. The shuttle complex 110 includes three librarystrings: library string A, library string B, and library string C. Thedepiction of each library string is broken into three sections, one fora set of scratch cartridges 112, one for a set of assigned cartridges114, and one for a set of tape drives 116. All sets 112, 114, and 116may be empty. Each library string is connected in a way that allowscartridges to be moved from any library string to any other librarystring, such as by a shuttle connection (not depicted).

Stage A represents the beginning state of the tape library. There areeleven scratch cartridges in library string A and no scratch cartridgesin library string B or library string C. There are eight assignedcartridges in library string A, five assigned cartridges in librarystring B, and seven assigned cartridges in library string C. There aretwo tape drives in library string A, one in library string B, and twotape drives in library string C.

Scenarios, such as in stage A, where there are a much larger number ofscratch cartridges in one library string are not uncommon. A commonconfiguration for a library string includes one library frame with aninput-output slot to insert and remove cartridges into the tape library.When expanding the tape library to include multiple library strings, theadditional library strings may not have a library frame with aninput-output slot because the cartridges can be moved from the librarystring with an input-output slot to the others. Thus, when anadministrator inserts cartridges, they would all start in the librarystring with the input-output slot, potentially creating a scenario whereall scratch cartridges are in the single library string.

At stage B, the library manager 102 determines the current state of theshuttle complex 110. The library manager 102 may be implemented invarious ways, and thus how the library manager 102 determines thecurrent state of the shuttle complex 110 can similarly vary. Forexample, the library manager 102 can maintain data that represents thestate of the shuttle complex 110. Because software communicates to thelibrary manager 102 instead of the shuttle complex 110, the librarymanager 102 can update the data that represents the state of the shuttlecomplex 110 in response to software requests. In these implementations,the library manager 102 is notified of any action taken by the shuttlecomplex 110 not in response to a request from the library manager 102.In other implementations, the library manager 102 can poll the shuttlecomplex 110 at regular intervals to get the current state of the shuttlecomplex 110. This may involve polling the shuttle complex 110 or pollingeach individual library string. Additionally, the library manager 102can determine the state of the shuttle complex 110 at the time of arequest.

At stage C, the library manager 102 determines if any scratch cartridgesshould be distributed to other library strings. For example, the librarymanager 102 may determine that because library string B and librarystring C do not have any scratch cartridges at stage A, at least onescratch cartridge can be moved from library string A to library string Band library string C. The library manager 102 then sends a series ofinstructions to the shuttle complex 110 or the individual components ofthe shuttle complex 110 in order to redistribute the scratch cartridges112.

Stage D depicts the shuttle complex 110 after the library manager 102has issued a series of instructions to the shuttle complex 110 todistribute one scratch cartridge from library string A to library stringB and library string C. The specific series of instructions will varybetween implementations. For example, in a tape library that implementsthe Small Computer System Interface (SCSI), the library manager 102 canissue two “MOVE MEDIA” commands, specifying the media to move (whichspecific scratch cartridges) and the target library strings (librarystring B and library string C).

This embodiment provides a technique that satisfies the basic conditionthat as many library strings as possible have at least one scratchcartridge. If the number of scratch cartridges 112 is less than thenumber of library strings, at least one library string will be without ascratch cartridge, but this is true of any embodiment. Additionally,having only one scratch cartridge in a library string means that if atape drive in that library string is available and the scratch cartridgein that library string is used to fulfill a request, the library stringhas no more scratch cartridges. The library manager 102 then distributesanother scratch cartridge to the library string if available. In ascenario where there are many requests for scratch cartridges within ashort period of time, the library manager 102 may still end uptransferring scratch cartridges from other library strings.

Stage E depicts the shuttle complex 110 after the library manager 102has issued a series of instructions to the shuttle complex 110 todistribute the scratch cartridges 112 as evenly as possible. The librarymanager 102 attempts to distribute the scratch cartridges 112 such thateach library string has an equal number of scratch cartridges. Thus, thelibrary manager 102 divides the total number of scratch cartridges 112by the number of library strings. If the number of library stringsdivides evenly into the total number of scratch cartridges 112, thenumber of scratch cartridges 112 in each library string will be equal.If the number of library strings does not divide evenly into the totalnumber of scratch cartridges 112, as in this example, at least onelibrary string will have fewer scratch cartridges 112 than the otherlibrary string(s). In this example, there are eleven scratch cartridges112 and three library strings. Thus, two library strings will have fourscratch cartridges and one will have three.

Assuming the number of scratch cartridges is not less than the number oflibrary strings, this embodiment provides at least one scratch cartridgeper library string, and can provide for multiple scratch cartridges perlibrary string. Thus, there is less of a chance that a library stringwill be without a scratch cartridge after a single request is fulfilledusing a tape drive in the library string. This technique results inequal or greater efficiency than only ensuring each library string hasone scratch cartridge. For example, assume the two tape drives inlibrary string C are the only available tape drives 116 and the librarymanager 102 receives two requests for scratch cartridges 112. Theshuttle complex 110 as depicted at stage D would be able to fulfill onerequest, then would move one scratch cartridge from another librarystring. Library string C would then have no scratch cartridges afterfulfilling both requests. The shuttle complex 110 as depicted at stageE, on the other hand, would be able to fulfill both requests withoutmoving a scratch cartridge from another library string, resulting inmore efficient operation. Additionally, library string C would stillhave two scratch cartridges after fulfilling both requests.

However, this embodiment can still lead to inefficient operation in somescenarios. For example, assume a tape library has two library strings,and the first library string has ten tape drives and the second librarystring has one tape drive. The probability of the first library stringhaving a free tape drive is greater than that of the second librarystring. Thus, if scratch cartridges are distributed evenly, it is likelythat the first library string will use all of its scratch cartridgesbefore the second library string does. Thus, the library manager willthen redistribute the scratch cartridges from the second library stringto the first. This problem can be solved by distributing the scratchcartridges in proportion to the number of tape drives in each librarystring.

Stage F depicts the shuttle complex 110 after the library manager 102has issued a series of instructions to the shuttle complex 110 todistribute the scratch cartridges 112 in proportion to the number oftape drives in each library string. The library manager 102 candetermine the number of scratch cartridges to go to each library stringby first dividing the total number of scratch cartridges in the tapelibrary by the total number of tape drives in the tape library andtaking the floor of the result. The library manager 102 then takes theresult and multiplies the number of tape drives in each library stringto get the number of scratch cartridges in the respective librarystrings. If the number in the first step resulted in a fractional value,there will be scratch cartridges left over. The library manager 102 candistribute these in various ways, and may change methods based on howmany scratch cartridges are left over. For example, the library manager102 can distribute the remaining scratch cartridges one-by-one startingwith the library string with the largest number of tape drives and goingin decreasing order. If the remaining number of scratch cartridges issmall, the library manager 102 can leave the scratch cartridges in theirsource library strings to avoid expending the electricity andpotentially taking time away from future requests for usage of theshuttle complex 110.

In the depiction of the shuttle complex 110 corresponding to stage F,the library manager 102 moved two scratch cartridges to library string Band four scratch cartridges to library string C, leaving five scratchcartridges in library string A. To determine these numbers, the librarymanager 102 first divides the total number of scratch cartridges(eleven) by the total number of tape drives (five). This results in thevalue of “two” after the floor of the quotient is taken. The librarymanager 102 then multiplies this value by the number of tape drives ineach library string. Thus, the library manager determines that fourscratch cartridges should go in library string A and library string C(two multiplied by two), and two scratch cartridges should go in librarystring B (two multiplied by one). There is one remaining scratchcartridge, which is left in the source library string A. Although theresult appears very close to the result in stage E, for larger number ofscratch cartridges the results continue to diverge in similarity. Forexample, if there were twenty-two scratch cartridges, the embodimentused in stage E would result in seven scratch cartridges in two librarystrings and eight in one library string. The embodiment used in stage Fwould result in eight scratch cartridges in two library strings and fourscratch cartridges in one library string, with two scratch cartridges tobe distributed as determined by the library manager 102.

Due to the potentially random nature of tape library use, no setdistribution may be the most efficient. Thus, the library manager 102can track the usage patterns of the shuttle complex 110, and, in someembodiments, the library manager 102 can use the usage patterns todetermine how to distribute the scratch cartridges. For example, thelibrary manager 102 may determine that a first library string uses twiceas many scratch cartridges as a second library string, even though ithas the same number of tape drives. The library manager 102 can thendistribute twice as many tape drives to the first library string as itdistributes to the second library string based on the usage pattern.

Additionally, the library manager 102 can include all discussedembodiments and techniques, and chose among them dynamically. Forexample, the library manager 102 may determine that under certain usagesscratch cartridges are used by library strings in proportion to thenumber of tape drives each library string contains. Thus, the librarymanager 102 may distribute the cartridges accordingly in anticipation ofthose usages. The library manager 102 may also determine that at othertimes, the usage pattern appears random, and thus may distribute thescratch cartridges evenly across all library strings.

Although the examples discussed above involve a set of library stringswhere all scratch cartridges begin in one library string, the inventivesubject matter is not so limited. For example, two of three librarystrings can contain multiple scratch cartridges, while the third librarystring contains none. The library manager 102 can then distribute thescratch cartridges from both library strings with multiple scratchcartridges to the third library string. In other words, the specificscratch cartridges moved can begin in any library string and bedistributed to any other library string.

Similar techniques can be applied within library strings as well. Forexample, the library manager 102 can ensure that scratch cartridges aredistributed evenly throughout the library string, maximizing the chancesthat a scratch cartridge will be located in a library frame with anavailable tape drive. If a particular library string has five libraryframes and ten scratch cartridges, the library manager 102 candistribute two scratch cartridges to each library frame. Otherdistributions, such as those that distribute scratch cartridges inproportion to the number of drives and based on usage patterns, can beused as well. For library strings with fewer scratch cartridges thanlibrary frames, the scratch cartridges can be distributed in a mannerthat minimizes the distance traveled to an available drive, as describedabove.

The inventive subject matter is not limited to scratch cartridges.Similar techniques can be applied to distributing assigned cartridges aswell. The number of assigned cartridges in one library string or libraryframe may be higher than the number of assigned cartridges in otherlibrary strings or library frames. Thus, these assigned cartridges maybe distributed using the similar techniques as described herein.

Similar techniques can be used when a tape library has multiple shuttleconnections. For example, assume the shuttle complex 110 has threeshuttle connections connecting library string A, library string B, andlibrary string C. It is possible to have the three cars associated withthe three shuttle connections located in one library string. If allthree cars are in library string A and a scratch cartridge is to bemoved from library string C to library string A, one of the cars travelsall the way to library string C to retrieve the scratch cartridge. Thelibrary manager 102 can distribute the cars such that the distancebetween a car and any one library string is minimized or the movementsare executed more efficiently. For example, if there are three librarystrings and three shuttle connections, the library manager 102 can keepone car at each library string. If there is only one shuttle connectionfor three library strings, the library manager 102 can keep the singlecar in library string B, making the maximum distance to travel for theinitial movement one library string. The library manager 102 could alsouse usage patterns to determine an efficient location for the cars. Forexample, in a tape library with three shuttle connections and threelibrary strings, the library manager 102 may determine that the tapelibrary 100 fetches scratch cartridges from one library string moreoften than the others. Thus, the library manager can decide to keep twocars in the library string that holds a larger number of scratchcartridges.

FIG. 2 and FIG. 3 depict a flowchart of example operations a librarymanager can perform to distribute scratch cartridges to a set ofinterconnected library strings in a tape library.

At block 200, the library manager retrieves the tape library stateinformation. The tape library state information (state information) canprovide details on the tape library configuration, such as how manylibrary strings exist in the tape library, how many library frames existin each library string, how each component is interconnected, etc. Thestate information can also provide the current location of all moveablecomponents and any pending or in-progress operations. The librarymanager can retrieve a subset of the information it needs, supplementingthe information by retrieving more information as needed throughout theprocess. The library manager can retrieve the state information byrequesting it from the shuttle complex, compiling it by sending requests(individual or combined into one) for the individual pieces ofinformation to the shuttle complex, or by maintaining it in memory.After the library manager retrieves the state information, control thenflows to block 202.

At block 202, the library manager determines the number of scratchcartridges that each library string should have, which will vary basedon the distribution used. For example, in the first distributiondiscussed above, the library manager attempts to have at least onescratch cartridge in each library string. Thus, the goal number ofscratch cartridges for each library string is one. The goal number ofscratch cartridges will be identified hereinafter by “#GOAL_SC.” Forthis distribution, the only goal is to have one scratch cartridge perlibrary string. Thus, any library string with more than one scratchcartridge will have “leftover” scratch cartridges. For this particulardistribution, the leftover scratch cartridges can be ignored.

In the second distribution discussed above, the library manager attemptsto distribute the scratch cartridges evenly among the library strings.Thus, the library manager determines #GOAL_SC by dividing the totalcount of scratch cartridges in the tape library by the total count oflibrary strings. The number of leftover scratch cartridges will be anyremainder resulting from determining the #GOAL_SC. Because the number ofleftover scratch cartridges will be less than the number of librarystrings, the library manager may choose to not distribute the leftoverscratch cartridges. In implementations where the number of librarystrings is large and a few library strings have a large portion of thescratch cartridges, the library manager may choose to distribute oneleftover scratch cartridge to as many library strings as possible.

In the third distribution discussed above, the library manager attemptsto distribute the scratch cartridges in proportion to the number of tapedrives in each library string. One way to determine this is by dividingthe total number of scratch cartridges in the tape library by the totalnumber of library strings in the tape library, then taking the floor ofthe result. This constant value is then multiplied by the number of tapedrives in each library string to get the #GOAL_SC for each respectivelibrary string. This differs from the previous two distributions in thateach library string may have a different #GOAL_SC, whereas in the priordistributions each library string had the same #GOAL_SC. The count ofleftover scratch cartridges will be less than the number of tape drivesin the tape library. The library manager may choose not to distributethe leftover scratch cartridges, or may choose to distribute them in avariety of ways. For example, the library manager may distribute theleftover cartridges as evenly as possible to each library string or candistribute them in to the library strings with the largest number oftape drives.

In the fourth distribution discussed above, the library managerdetermines the distribution based on the usage pattern of the tapelibrary. Using the usage pattern, the library manager can determine anindividual #GOAL_SC for each library string. For example, if the librarystring determines that the first library string uses twice as manyscratch cartridges as the second, the library manager can assign twiceas many scratch cartridges to the first library string as the second.This can happen regardless of the number of tape drives in the librarystrings. The count of leftover scratch cartridges will vary based on theusage pattern. Due to the increased flexibility afforded by determininga distribution based on the usage history, the library manager can takeinto account the total count of scratch cartridges, thus eliminatingleftover scratch cartridges altogether. After the library manager hasdetermined the #GOAL_SC for each library string, control then flows toblock 204.

At block 204, the library manager begins a first loop in which itdetermines which library strings have a number of scratch cartridgesgreater than their respective #GOAL_SC. The loop is initialized bygenerating a list of all library strings if not already available. Thefirst library string in the list is made the current library string.Control then flows to block 206.

At block 206, the library manager determines if the current librarystring has more scratch cartridges than the current library's #GOAL_SC.If the current library string has more scratch cartridges than the#GOAL_SC for the current library string, control then flows to block210. If the current library string has fewer scratch cartridges than the#GOAL_SC for that library string, control then flows to block 208.

At block 208, the library manager records an indication of the currentlibrary string, such as an identifier, to a new list, hereinafterreferred to as the MOVE_TO list. The library manager also records thecurrent count of scratch cartridges located in the current librarystring minus the #GOAL_SC for the current library string. This valuerepresents the differential between the current count of scratchcartridges and the goal number of cartridges for the current librarystring. This value will be referred to hereinafter as the #DIFF_SC forthe particular library string. All library strings on the MOVE_TO listwill have a negative #DIFF_SC. Control then flows to block 212.

Control flowed to block 210 if the library manager determined that thecurrent library string had a number of scratch cartridges greater than#GOAL_SC at block 206. At block 210, the library manager records anindication of the current library string, such as an identifier, and the#DIFF_SC for the current library string to a new list, referred tohereinafter as the MOVE_FROM list. All library strings on the MOVE_FROMlist will have a positive #DIFF_SC. Control then flows to block 212.

Control flowed to block 212 from block 208 and block 210. At block 212,the library manager determines if there are more library strings in thelist of all library strings. If more library strings are in the list ofall library strings, control then flows back to block 204. If alllibrary strings have been iterated over, control then flows to block214.

At block 214, the first loop ends. The library manager will haveiterated over each library string. The library manager will have twolists, a MOVE_TO and MOVE_FROM list, each indicating disjoint sets oflibrary strings and the individual #DIFF_SC values. Library strings thatalready have a count of scratch cartridges equal to their #GOAL_SC willnot appear on either list. Control then flows to block 316 in FIG. 3.

At block 316, the library manager begins a second loop in which thelibrary manager distributes the scratch cartridges from library stringshaving a positive #DIFF_SC to those library strings that have a negative#DIFF_SC scratch cartridges. The loop is initialized by selecting thefirst library string of the MOVE_TO list as the current target librarystring. The first library string of the MOVE_FROM list is selected asthe current source library string. On each subsequent pass through theloop, the library manager selects the next library string in the MOVE_TOlist. Control then flows to block 318.

At block 318, the library manager generates and issues a move commandspecifying that a scratch cartridge should be moved from the sourcelibrary to the target library. Some implementations may generate thecommand, save it, and then issue all move commands at the end. Controlalso flows back to block 318 if the library manager determines that thetarget library string has a negative #DIFF_SC value, creating adistribution loop specific to the current target tape library. Controlthen flows to block 320.

At block 320, the library manager decrements the current source library#DIFF_SC value and increments the current target library #DIFF_SC value.Decrementing and incrementing the respective #DIFF_SC values reflect thecurrent state of the tape library if the move commands are issued. Ifthe move commands are not issued, it reflects the state of the tapelibrary as it will be after the move commands. Control then flows toblock 322.

At block 322, the library manager determines if the #DIFF_SC value forthe current source library string is greater than zero. If the currentsource library string has a #DIFF_SC value greater than zero, controlthen flows to block 325. If the current source library does not have a#DIFF_SC value greater than zero, control then flows to block 324.

At block 324, the library manager moves the pointer that indicates thecurrent source library string in the MOVE_FROM list to the next librarystring in the MOVE_FROM list. Because the current source library stringno longer has a surplus of scratch cartridges, the next library stringin the MOVE_FROM list becomes the new source. Control then flows toblock 325.

Control flowed to block 325 if the library manager determined that thecurrent source library string still has a surplus of scratch cartridgesat block 322. Control also flowed to block 325 from block 324. At block325, the library manager determines if the #DIFF_SC value for thecurrent target string is less than zero. A negative #DIFF_SC valueindicates that the current target string has fewer scratch cartridgesthan the goal number of scratch cartridges. If the library managerdetermines that the current target library string has a negative#DIFF_SC, control then flows back to block 318. If the library managerdetermines that the current target library string does not have anegative #DIFF_SC, control then flows to block 326.

At block 326, the library manager moves the pointer that indicates thecurrent target library string in the MOVE_TO list to the next librarystring in the MOVE_TO list. Because the current target library string nolonger has less scratch cartridges than the goal number, the nextlibrary string in the MOVE_TO list becomes the new target. Control thenflows to block 327.

At block 327, the library manager determines whether there are morelibrary strings in the MOVE_TO list. This can be determined by checkingto see if the MOVE_TO pointer is pointing to the last library string inthe list or not. If the library manager determines that there are morelibrary strings in the MOVE_TO list, control flows back to block 316. Ifthe library manager determines that there are no more library strings inthe MOVE_TO list, control then flows to block 328.

At block 328, the library string ends the scratch cartridge distributionloop. The scratch cartridges are distributed among the library stringsin accordance with the particular distribution used by the librarymanager, with the exception of any leftover scratch cartridges. Thelibrary manager may choose to distribute the remaining scratchcartridges as discussed above or leave them where they are.

When a program requests use of a scratch cartridge, the library managerfirst searches for a scratch cartridge. After finding a scratchcartridge, the library manager then searches for an available tapedrive. If a scratch cartridge is found in the first of three librarystrings, and the only available tape drive is in the third, the librarymanager moves the scratch cartridge from the first library string to thethird. If the third library string has a scratch cartridge, thismovement is unnecessary and inefficient.

Furthermore, even efficient distribution of scratch cartridges, asdiscussed above, does not make tape library usage more predictable.While some programs will run at regular intervals, and may request useof the tape library at predictable intervals, many programs do not.Thus, there may be a sudden, unexpected increase in requests to use thetape library that the library manager cannot prepare for. Furthermore,even when programs run at regular intervals, the amount of data that theprograms read or write may be different, leading to unpredictable tapedrive availability. For example, a backup program that backs up the dataon a particular server may run daily at the same time. But many backupprograms do incremental backups, backing up only the data that changedsince the most recent backup. Thus, if very little data has changed, theparticular tape drive that the library manager selects may be in use fora very short period of time. If a large portion of data has changed, theparticular tape drive that the library manager selects may be in use fora long period of time. This unpredictability can lead to scenarios inwhich the library manager searches for scratch cartridges outside of alibrary string containing an unavailable tape drive.

FIG. 4 depicts a tape library system that is designed to efficientlyfind an available tape drive and scratch cartridge, minimizing thedistance traveled by a scratch cartridge.

FIG. 4 depicts a tape library 400, including a library manager 402 andthree library strings: A, B, and C. The depiction of each library stringis broken into three sections, one for a set of scratch cartridges 412,one for a set of assigned cartridges 414, and one for a set of tapedrives 416. Any one of the sets 412, 414, and 416 may be empty. Eachlibrary string is connected in some way that allows cartridges to bemoved from any library string to any other library string, such as ashuttle connection (not depicted).

At stage A, the library manager 402 selects the least recently used tapedrive. The library manager 402 can keep track of the individual tapedrives and their usage or can query each tape drive to find when eachwas last used. In this example, the tape drive in library string B isthe least recently used tape drive, and is thus selected by the librarymanager 402. The library manager 402 then determines if there is ascratch cartridge in the same library string as the selected tape drive.If so, the library manager 402 uses a scratch cartridge from the samelibrary string as the selected tape drive. If not, the library manager402 selects the next least recently used tape drive.

At stage B, the library manager 402 selects the next least recently usedtape drive, located in library string C. The library manager 402 onceagain determines if any scratch cartridges exist in the same librarystring as the selected tape drive. If so, the library manager 402 uses ascratch cartridge from the same library string as the selected tapedrive. If not, the library manager 402 continues selecting availabletape drives, in order from least recently used to most recently used,and determines if a scratch cartridge exists in the same library string.The library manager 402 can skip available tape drives if they arelocated in the same library string as a previously selected tape drivebecause it has already determined that no scratch cartridges are in thatlibrary string.

At stage C, the library manager 402 has selected each available tapedrive and determined that no scratch cartridge exists in the samelibrary string as an available tape drive. The library manager 402selects the least recently used tape drive again, located in librarystring B. The library manager 402 then determines if a scratch cartridgeexists in any adjacent library string. If a scratch cartridge exists inan adjacent library string, the library manager 402 selects the scratchcartridge. In this example, the library manager finds a scratchcartridge in library string A.

At stage D, the library manager 402 issues a move command, instructingthe tape library 400 to move the scratch cartridge found at stage C fromlibrary string A to library string B. The library manager 402 alsoissues a mount command, instructing the tape library 400 to mount thescratch cartridge found at stage C. To mount the scratch cartridge, thescratch cartridge is inserted into the available tape drive.

In some embodiments, if no scratch cartridge is available in any of thelibrary strings with available tape drives, the library manager 402 willselect the least recently used tape drive as above. But if no scratchcartridge is found in an adjacent library string, the library manager402 will not search library strings that are farther away. Instead, thelibrary manager 402 will search the list of available drives until anavailable tape drive in another library string is found. The librarymanager 402 will then search library strings adjacent to the librarystring with the second chosen tape drive. Again, if no scratchcartridges are found in adjacent library strings, the library manager402 will continue through the list until it finds a third available tapedrive in a third library string. This process is repeated until the listis exhausted or a scratch cartridge is found in a library stringadjacent to an available drive. If no scratch cartridge is found, theprocess is repeated, but the library manager 402 searches librarystrings that are two library strings away. This increasing search radiusis continued until a scratch cartridge is found.

FIG. 5 depicts a flowchart of example operations a library manager canperform to find an available tape drive and scratch cartridge.

At block 500, the library manager generates a list of all available tapedrives. The list will be used to find available tape drives in leastrecently used order, and thus can be sorted from least recently usedtape drive to most recently used tape drive. The library manager canaccomplish this without a list, polling each tape drive to see if it isavailable and when it was last used. After generating a list of allavailable tape drives, control then flows to block 502.

At block 502, the library manager begins an initial search loop in whichit attempts to find a scratch cartridge in the same tape library as anavailable tape drive. The library manager initializes the loop selectingthe least recently used tape drive from the list generated in block 500as the current scratch cartridge. If a list was not generated, thelibrary manager searches the tape library for the least recently usedtape drive directly. On each additional pass through the loop, thelibrary manager selects the next least recently used available tapedrive that is in a library string that has not already been checked.Control then flows to block 504.

At block 504, the library manager determines if there is a scratchcartridge in the same library string as the current tape drive. Thelibrary manager can determine if there is a scratch cartridge in thesame library string as the current tape drive by referring to the tapelibrary state information it keeps track of, polling the library string,or taking other action based on the specific implementation. If thelibrary manager determines there is a scratch cartridge in the samelibrary string as the current tape drive, control then flows to block522. If the library manager determines there is no scratch cartridge inthe same library string as the current tape drive, control then flows toblock 506.

At block 506, the library manager determines if there are more uncheckedavailable tape drives. The library manager will make the determinationdepending on the specific actions taken at block 500. To moreefficiently search the library strings, the library manager will ignoretape drives that are in library strings that have already been checkedon previous iterations. If the library manager determines there are moreunchecked available tape drives, control then flows back to block 502.If the library manager determines there are no more unchecked availabletape drives, control then flows to block 508.

At block 508, the library manager completes the first scratch cartridgesearch loop. At this point in the process, the library manager hassearched all library strings with available tape drives and found nonethat have scratch cartridges. Control then flows to block 510.

At block 510, the library manager begins a second search loop, in whichit searches for a scratch cartridge that is closest to the leastrecently used tape drive. The library manager initializes the loop byselecting the least recently used tape drive and initializing avariable, N, to 1. The variable N represents the number of librarystrings away from the library string containing the least recently usedtape drive to search. On each additional iteration, the library managerincrements N. Control then flows to block 512.

At block 512, the library manager determines if there is a scratchcartridge N library strings away from the selected tape drive. On thefirst pass through the loop beginning at block 510, N will be 1, andthus the library manager will search adjacent library string for scratchcartridges. On the second pass through the loop beginning at block 510,N will be 2, and thus the library manager will search library stringsthat are two library strings away. If the library manager determinesthere is a scratch cartridge N library strings away from the selectedtape drive, control then flows to block 520. If the library managerdetermines there is no scratch cartridge N library strings away from theselected tape drive, control then flows to block 514.

At block 514, the library manager determines if there are more uncheckedlibrary strings. The library manager can determine this by calculatingthe number of library strings between the tape drive and the edgelibrary strings. The library manager then selects the distance to thefurthest edge library string, and compares its distance with N. If N isequal to the distance to the furthest edge library string, all librarystrings have been checked. If the library manager determines that thereare more unchecked library strings, control then flows back to block510. If the library manager determines that there are no more uncheckedlibrary strings, control then flows to block 516.

At block 516, the library manager completes the second search loop. Thelibrary manager has found no available scratch cartridges, and thus allcartridges are in use. Control then flows to block 518.

At block 518, the library manager either issues an error to the programrequesting use of a scratch cartridge or delays processing the requestuntil a scratch cartridge becomes available. Errors or othernotifications can be made to alert operators that all scratch cartridgesare being used.

Control flowed to block 520 if the library manager found a scratchcartridge at block 512. At block 520, the library manager issues a movecommand to move the scratch cartridge from the source library string tothe target library string. The target library string is the librarystring with the least recently used tape drive. Control then flows toblock 522.

Control flowed to block 522 if the library manager found a scratchcartridge at block 504. Control also flowed to block 522 from block 520.At block 522, the library manager issues a mount command, specifying theavailable tape drive and the scratch cartridge that is located in thelibrary string with the available tape drive. The tape library thusmounts the scratch cartridge into the available tape drive, making itavailable for the requesting program.

Optimizing the distribution of scratch cartridges and other componentsof a tape library, along with optimizing the selection of available tapedrives and scratch cartridges may increase the efficiency of a tapelibrary. But additional efficiency can be gained by utilizing movementof various components to accomplish multiple tasks at the same time. Forexample, if scratch cartridges are unevenly distributed, the librarymanager may want to redistribute them in an efficient manner, asdiscussed above. But if the library manager is servicing a large numberof requests at one time, the library manager may not be able to stopservicing those requests to redistribute the scratch cartridges.

When the tape library services a request, there are times when thevarious mechanisms that transport the cartridges move from one locationto another while empty. This can be wasted movement. For example, assumea tape library has three library strings. The first library stringcontains ten scratch cartridges and the car for a single shuttleconnection. The third library string contains no scratch cartridges. Ifthe tape library receives a request to get a cartridge from the thirdlibrary string and move it to another, the car would typically be emptyas it traveled from the first library string to the third. But, a tapelibrary can be designed such that the car transports one of the tenscratch cartridges to the third library string from the first librarystring, accomplishing two goals at once.

FIG. 6 depicts a tape library system that is designed to distributescratch cartridges in conjunction with the servicing of other requests.FIG. 6 depicts a tape library 600, including a library manager 602 andthree library strings: A, B, and C. The depiction of each library stringis broken into three sections, one for a set of scratch cartridges 612,one for a set of assigned cartridges 614, and one for a set of tapedrives 616. Any one of the sets 612, 614, and 616 may be empty. Eachlibrary string is connected in some way that allows cartridges to bemoved from any library string to any other library string, such as ashuttle connection (not depicted). A software program 604 is alsodepicted.

At stage A, the software program 604 requests the use of a cartridgefrom the library manager 602. This scenario can occur when the softwareprogram 604 previously requested a scratch cartridge to write data to.After the software program 604 completed writing the data, the librarymanager 602 assigned the cartridge to the software program 604. Aftersome time, the software program 604 requests the use of the cartridgeagain to either read the previously written data or write more data. Thelibrary manager 602, after receiving the request to use the cartridgefrom the software program 604, determines that the requested cartridgeis in library string C, and that an available tape drive is in librarystring B. The library manager 602 also determines the location of theshuttle connection car. In this example, the car is assumed to be inlibrary string A.

At stage B, the library manager 602 determines that library string C hasno scratch cartridges. The library manager 602 may determine the numberof scratch cartridges in a particular library string by polling thelibrary string, looking up the number of scratch cartridges in statedata that the library manager 602 tracks, or other ways that arespecific to the particular implementation.

At stage C, the library manager 602 determines that there are scratchcartridges in library string A, the starting location of the car. Thelibrary manager 602 also determines that moving a scratch cartridge tolibrary string C may have a beneficial impact on efficiency. Forexample, if a library manager 602 is configured to distribute scratchcartridges evenly, as discussed above, the library manager 602 candetermine that by moving a scratch cartridge from library string A tolibrary string C, the distribution becomes closer to an evendistribution. Thus, the library manager 602 issues a command to move ascratch cartridge from library string A to library string C.

At stage D, the tape library 600 moves the scratch cartridge fromlibrary string A to library string C. The tape library 600 first loadsthe scratch cartridge into the empty car for the shuttle connection. Thetape library 600 then causes the car to move along the shuttleconnection from library string A to library string C. The tape library600 then has the scratch cartridge deposited into library string C.

At stage E, the library manager 602 issues a command to move therequested cartridge from the source library string, library string C, tothe target library string, library string B. Because the softwareprogram 604 requested use of the cartridge, the cartridge is mountedinto a tape drive. At stage A, the library manager 602 determined thatthe only available tape drive was in library string B. Thus, to mountthe cartridge into an available tape drive, the library manager 602issues a command to move the requested cartridge from library string Cto library string B.

At stage F, the tape library 600 moves the requested cartridge fromlibrary string C to library string B. Similar to stage D, the tapelibrary 600 first loads the requested cartridge into the empty car forthe shuttle connection. The tape library 600 then causes the car to movealong the shuttle connection from library string C to library string B.The tape library 600 then has the requested cartridge deposited intolibrary string B.

At stage G, the library manager 602 issues a command to mount therequested cartridge into the available tape drive.

At stage H, the tape library 600 mounts the cartridge into the availabledrive. The tape library 600 moves the cartridge from where it wasdeposited by the shuttle connection to the library frame in which theavailable tape drive is located. The tape library 600 then causes thelibrary frame robotic arm to insert the cartridge into the tape drive.

Any movement of a shuttle connection car in which the car is empty hasthe potential to be inefficient. If the library manager 602 had onlyissued the command to move the requested cartridge from library string Cto library string B, the car would have moved from library string A tolibrary string C while empty. The tape library 600 described aboveincreases efficiency by incrementally improving the state of the tapelibrary 600 by using the movement of components that would normally bepartially wasted movement.

In some embodiments, the library manager is not limited toredistributing scratch cartridges while servicing a request. If alibrary manager receives multiple requests, those requests may bereordered or combined to increase efficiency. For example, assume a tapelibrary with three library strings and one shuttle connection with thecar located at the first library string. The library manager can get tworequests, a first that requests a cartridge be moved from the thirdlibrary string to the second, and a second that requests a cartridge bemoved from the first library string to the third. If the library managercompletes the requests in this order, the car travels a total of sixlibrary strings. The library manager can either reorder the requests, orcombine the requests to decrease the number of library strings traveledto three. Instead of completing the first request first, the librarymanager would move the second requested cartridge from the first librarystring, where the car starts, to the third library string. The librarymanager would then load the first requested cartridge into the car andmove it to the second library string.

FIG. 7 depicts a flowchart of example operations a library manager canperform to distribute scratch cartridges while servicing other requests.

At block 700, a library manager receives a request to mount a cartridge.As discussed above, this can occur when a software program haspreviously written to a particular cartridge, and wants to read from orwrite to the same cartridge. Control then flows to block 702.

At block 702, the library manager determines whether the requestedcartridge is to be moved to another library string. This scenario ariseswhen the only available tape drive is in a library string different fromthe one that has the requested cartridge. If the requested cartridge isin the same library string as an available tape drive, no movementbetween library strings is done. If the library manager determines thatthe requested cartridge is to be moved to another library string,control then flows to block 704. If the library manager determines thatthe requested cartridge is not to be moved to another library string,control then flows to block 718.

At block 704, the library manager determines if a car for a shuttleconnection is located in the same library string as the requestedcartridge. If the library manager determines that a car is located inthe same library string as the requested cartridge, control then flowsto block 714. If the library manager determines that a car is notlocated in the same library string as the requested cartridge, controlthen flows to block 706.

At block 706, the library manager determines if the library string withthe requested cartridge has a deficiency of scratch cartridges. The goalvalue can be determined any number of ways, including as part of adistribution algorithm or being manually set by an operator. Forexample, in the example distributions discussed above, each particulardistribution has a goal for the number of scratch cartridges in eachlibrary string. If the library manager is configured to evenlydistribute the scratch cartridges, there are three library strings, andthere are nine scratch cartridges, then the goal would be three scratchcartridges in each library string. Thus, the library manager wouldconsider a library string with less than three scratch cartridges ashaving a deficiency of scratch cartridges. If the library managerdetermines that there is a deficiency of scratch cartridges in thelibrary string with the requested cartridge, control then flows to block708. If the library manager determines there is not a deficiency ofscratch cartridges in the library string with the requested cartridge,control then flows to block 716.

At block 708, the library manager determines if any library strings withan available car have an excess of scratch cartridges. As discussedabove with block 706, each library string can have a goal value for thenumber of scratch cartridges the library string should have. If aparticular library string has a higher number of scratch cartridges thanthe library string's goal value, it has an excess of scratch cartridges.If a library string has an excess of scratch cartridges but no availablecar, some of the efficiency would be lost by moving a car to the librarystring with an excess of scratch cartridges. If the library managerdetermines that a library string has an excess of scratch cartridges andan available car, control then flows to block 710. If the librarymanager determines that no library strings have an excess of scratchcartridges and an available car, control then flows to block 716.

At block 710, a scratch cartridge is loaded into an available carlocated in a library string with an excess of scratch cartridges. Thescratch cartridge is also moved, via the car, to the library stringcontaining the requested cartridge. Control then flows to block 712.

At block 712, the scratch cartridge is deposited into the library stringcontaining the requested cartridge. The requested cartridge is thenloaded into the car that brought the scratch cartridge. The requestedcartridge is then moved to the library string with the available tapedrive via the car. Control then flows to block 718.

Control flowed to block 714 if the library string determined that a carwas located in the same library string as the requested cartridge atblock 704. At block 714, the requested cartridge is moved to the librarystring with the tape drive using the car located in the library stringcontaining the requested cartridge. Because a car is located in the samelibrary string as the requested cartridge, no efficiency is gained bywaiting for another car to be moved to the same library string. Controlthen flows to block 718.

Control flowed to block 716 if the library manager determined that thelibrary string containing the requested cartridge does not have anexcess of scratch cartridges at block 706. Control also flowed to block716 if the library manager determined that no library string containedan excess of scratch cartridges and contained an available car. At block716, the available car is moved to the library string containing therequested cartridge. The requested cartridge is loaded into the car, andthe car transports the requested cartridge to the library string withthe available tape drive. Control then flows to block 718.

Control flowed to block 718 if the library manager determined that therequested cartridge was in the same library string as the available tapedrive at block 702. Control also flowed to block 718 from block 712,block 714, and block 716. At block 718, the requested cartridge ismounted into the available tape drive. The requested cartridge may bemoved from the library frame containing the shuttle connection to thelibrary frame containing the available tape drive if they are different.The library frame robotic arm then inserts the requested cartridge intothe available tape drive. The process ends.

The inventive subject matter is not limited to moving cartridges betweenlibrary strings, and can be used to increase the efficiency of movementwithin an individual library string as well. In other words, themovement of cartridges between library frames within the same librarystring can be optimized similarly to the movement of cartridges betweenlibrary strings. Additionally, most examples discussed tape librarieswith only one shuttle connection. The inventive subject matter is not solimited, and can apply to tape libraries with any number of libraryframes, library strings, and shuttle connections. Furthermore,references are made to utilizing a least recently used algorithm toselect specific components from a set of components. The inventivesubject matter is not limited to using a least recently used algorithm,and may use others including a most recently used algorithm, analgorithm based on component utilization, a random selection algorithm,etc.

As example flowcharts, the flowcharts depicted present operations inexample order from which embodiments can deviate (e.g., operations canbe performed in a different order than illustrated and/or in parallel).Many of the specific operations will be dependent on the actualimplementation. For example, additional operations are needed if thelibrary manager is not the sole interface that communicates with thetape library components. Also, as discussed, if the library manager orother related software keeps updated state information about the tapelibrary, no gathering of information is done in any of the flowcharts.Some optimization operations are not included in the flowcharts ordiscussed, as they would be apparent to one skilled in the art. Forexample, if the current state of the tape library is such that fewoperations are required to achieve the desired distribution ofcartridges, the library manager may forego any distribution of thecartridges. In other words, if the current state of the tape library isnear enough to the goal state, the efficiency gained by furtherdistributing the cartridges may be less than the cost of distributingthe cartridges.

Although library frames are discussed as being connected side-by-side,they may be connected in any manner that permits cartridges to betransported from one to another. Additionally, the library manager isdescribed as doing many of the operations. The inventive subject matteris not so limited. The software programs that are discussed asinteracting with the library manager may interact directly with the tapelibrary in some implementations, and may implement all techniquesdiscussed. The library manager can be a part of the tape library orseparate from the tape library, such as being embodied as a separateserver that is coupled to the tape library. The functionality discussedcan also be implemented in hardware or firmware, in addition tosoftware, or as a combination of all three. Furthermore, the librarymanager can be a collection of different software applications thatinteract to perform the operations described herein. For example, theactual interface with the tape library may be embodied in a SCSI cardlocated on a server. The library manager would interface with the SCSIcard, and the SCSI card would interface with the tape library by issuingthe actual commands and receiving responses or other messages from thetape library.

The idea of efficiency is discussed throughout. Efficiency can bedefined many ways, including ways not specifically discussed. Forexample, efficiency is frequently discussed as being tied to thedistance a component travels, the time it takes for the component totravel between locations, or the cost or amount of electricity used. Butefficiency can also apply to things such as decreasing the amount ofwear and tear on the system or, similarly, extending the life ofparticular components. As such, when discussing efficiency, theinventive subject matter is not limited to the specific types ofefficiency referenced.

As will be appreciated by one skilled in the art, aspects of the presentinventive subject matter may be embodied as a system, method or computerprogram product. Accordingly, aspects of the present inventive subjectmatter may take the form of an entirely hardware embodiment, an entirelysoftware embodiment (including firmware, resident software, micro-code,etc.) or an embodiment combining software and hardware aspects that mayall generally be referred to herein as a “circuit,” “module” or“system.” Furthermore, aspects of the present inventive subject mattermay take the form of a computer program product embodied in one or morecomputer readable medium(s) having computer readable program codeembodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent inventive subject matter may be written in any combination ofone or more programming languages, including an object orientedprogramming language such as Java, Smalltalk, C++ or the like andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The program codemay execute entirely on the user's computer, partly on the user'scomputer, as a stand-alone software package, partly on the user'scomputer and partly on a remote computer or entirely on the remotecomputer or server. In the latter scenario, the remote computer may beconnected to the user's computer through any type of network, includinga local area network (LAN) or a wide area network (WAN), or theconnection may be made to an external computer (for example, through theInternet using an Internet Service Provider).

Aspects of the present inventive subject matter are described withreference to flowchart illustrations and/or block diagrams of methods,apparatus (systems) and computer program products according toembodiments of the inventive subject matter. It will be understood thateach block of the flowchart illustrations and/or block diagrams, andcombinations of blocks in the flowchart illustrations and/or blockdiagrams, can be implemented by computer program instructions. Thesecomputer program instructions may be provided to a processor of ageneral purpose computer, special purpose computer, or otherprogrammable data processing apparatus to produce a machine, such thatthe instructions, which execute via the processor of the computer orother programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

FIG. 8 depicts an example computing system with a library manager. Acomputing system includes a processor unit 801 (possibly includingmultiple processors, multiple cores, multiple nodes, and/or implementingmulti-threading, etc.). The computing system includes memory 803. Thememory includes a library manager with strategic distribution andcartridge selection (library manager) 805. The memory 803 may be systemmemory (e.g., one or more of cache, SRAM, DRAM, zero capacitor RAM, TwinTransistor RAM, eDRAM, EDO RAM, DDR RAM, EEPROM, NRAM, RRAM, SONOS,PRAM, etc.) or any one or more of the above already described possiblerealizations of machine-readable media. The computing system alsoincludes a bus 811 (e.g., PCI, ISA, PCI-Express, HyperTransport® bus,InfiniBand® bus, NuBus bus, etc.), I/O devices 809 (e.g., keyboard,mouse, monitor, microphone, speaker, etc.), a network interface 807(e.g., an ATM interface, an Ethernet interface, a Frame Relay interface,SONET interface, wireless interface, etc.), a cache 817 (e.g., a directmapped cache, a 2-way set associative cache, a fully associative cache,etc.) and a storage device(s) 813 (e.g., optical storage, magneticstorage, etc.). The cache 817 may be a lower level cache (e.g., L1 cacheembodied in a processor) or a higher level cache (e.g., L2 cache, L3cache, etc.). The library manager 805 embodies functionality toimplement embodiments described above. The library manager 805 functionsas described above, distributing scratch cartridges and other componentsbetween the various parts of a tape library. The library manager 805also selects scratch cartridges for available tape drives in response toa request. Additionally, the library manager 805 can manage requests insuch a way that accomplishes multiple goals at the same time, such asdistributing cartridges while servicing a request or reordering andcombining requests to increase efficiency. Although the library manager803 is depicted as residing in the memory 803, any one of thesefunctionalities may be partially (or entirely) implemented in hardwareand/or on the processing unit 801. For example, the functionality may beimplemented with an application specific integrated circuit, in logicimplemented in the processing unit 801, in a co-processor on aperipheral device or card, etc. Additionally, functionality may beembodied in other components, such as the interface with the tapelibrary being part of the network interface 807. Further, realizationsmay include fewer or additional components not illustrated in FIG. 8(e.g., video cards, audio cards, additional network interfaces,peripheral devices, etc.). The processor unit 801, storage device(s)813, network interface 807, cache 817, and I/O devices 809 are coupledto the bus 811. Although illustrated as being coupled to the bus 811,the memory 803 may be coupled to the processor unit 801.

While the embodiments are described with reference to variousimplementations and exploitations, it will be understood that theseembodiments are illustrative and that the scope of the inventive subjectmatter is not limited to them. In general, techniques for mass storagesystems as described herein may be implemented with facilitiesconsistent with any hardware system or hardware systems. Manyvariations, modifications, additions, and improvements are possible.

Plural instances may be provided for components, operations orstructures described herein as a single instance. Finally, boundariesbetween various components, operations and data stores are somewhatarbitrary, and particular operations are illustrated in the context ofspecific illustrative configurations. Other allocations of functionalityare envisioned and may fall within the scope of the inventive subjectmatter. In general, structures and functionality presented as separatecomponents in the exemplary configurations may be implemented as acombined structure or component. Similarly, structures and functionalitypresented as a single component may be implemented as separatecomponents. These and other variations, modifications, additions, andimprovements may fall within the scope of the inventive subject matter.

What is claimed is:
 1. A method comprising: determining a location of afirst drive in a storage medium library; determining whether a storagemedium is located within a first distance from the first drive; inresponse to determining that a storage medium is not located within thefirst distance from the first drive, determining a location of a seconddrive in the storage medium library; determining whether a storagemedium is located within the first distance from the second drive; andin response to determining that a storage medium is located within thefirst distance from the second drive, making the storage mediumavailable to be read by or written to by the second drive.
 2. The methodof claim 1, further comprising: in response to determining that astorage medium is not located within the first distance from the seconddrive, determining whether a storage medium is located within a seconddistance from the first drive, wherein the second distance is fartherthan the first distance; and in response to determining that a storagemedium is located within the first distance or the second distance fromthe first drive, making the storage medium available to be read by orwritten to by the first drive.
 3. The method of claim 1 furthercomprising determining that the first drive is the least recently useddrive.
 4. The method of claim 1, wherein said determining the locationof the second drive in the storage medium library comprises determiningthat the second drive is the least recently used drive excluding thefirst drive.
 5. The method of claim 4, wherein the location of the firstdrive comprises a first library unit, and wherein said determining thelocation of the second drive further comprises determining that thesecond drive is the least recently used drive not in the first libraryunit.
 6. The method of claim 1 further comprising: in response todetermining that the storage medium is not located within the seconddistance from the first drive, determining whether a storage medium islocated within the second distance from the second drive; and inresponse to determining that a storage medium is located within thesecond distance from the second drive, making the storage mediumavailable to be read by or written to by the second drive.
 7. The methodof claim 1, wherein the storage medium comprises a tape cartridge, thestorage medium library comprises a tape library and a library unit isone of a library frame and library string.
 8. A computer program productcomprising: a computer readable storage medium having programinstructions embodied therewith, the program instructions comprisingprogram instructions to, determine whether any drive associated with anydrive identifier of a plurality of drive identifiers is located in asame library string as a scratch storage medium, wherein the scratchstorage medium is a storage medium that is not assigned to a particularsoftware program; and in response to a determination that a first driveassociated with a first drive identifier of the plurality of driveidentifiers is located in the same library string as a first scratchstorage medium, issue a command to transport the first scratch storagemedium to the first drive associated with the first drive identifier ofthe plurality of drive identifiers that is located in the same librarystring as the first scratch storage medium.
 9. The computer programproduct of claim 8, wherein the determination of whether any driveassociated with any drive identifier of the plurality of driveidentifiers is located in a same library string as a scratch storagemedium is performed during a first iteration over the plurality of driveidentifiers, and wherein the program instructions further compriseprogram instructions to: further in response to the determination thatthe first drive associated with a first drive identifier of theplurality of drive identifiers is located in the same library string asa first scratch storage medium, halt the first iteration over theplurality of drive identifiers in response to a determination that nodrive associated with the drive identifier of the plurality of driveidentifiers is located in the same library string as a scratch storagemedium, begin a second iteration over the plurality of driveidentifiers; while iterating over the plurality of drive identifiers thesecond time, determine whether any drive associated with any driveidentifier of the plurality of drive identifiers is located in a librarystring adjacent to a library string containing a scratch storage medium;and in response to a determination that a second drive associated with asecond drive identifier of the plurality of drive identifiers is locatedin a library string adjacent to a library string that contains a secondscratch storage medium, halt the second iteration over the plurality ofdrive identifiers; and issue a command to transport the second scratchstorage medium to the second drive associated with the second driveidentifier of the plurality of drive identifiers that is located in thelibrary string adjacent to the library string that contains the secondscratch storage medium.
 10. The computer program product of claim 9,wherein a first library string is adjacent to a second library string ifa storage medium can be moved from the first library string to thesecond library string without passing through a third library string.11. The computer program product of claim 9, wherein the programinstructions performed during the first iteration comprise programinstructions to select the first drive identifier of the plurality ofdrive identifiers, wherein the first drive is the least recently useddrive that is associated with a drive identifier that has not beeniterated over, wherein the program instructions to determine whether anydrive associated with any drive identifier of the plurality of driveidentifiers is located in a same library string as a scratch storagemedium comprises program instructions to determine that the first driveassociated with the first drive identifier of the plurality of driveidentifiers is not located in a same library string as a scratch storagemedium, wherein the program instructions further comprise programinstructions to: in response to a determination that the first driveassociated with the first drive identifier of the plurality of driveidentifiers is not located in the same library string as a scratchstorage medium, select a second drive identifier of the plurality ofdrive identifiers, wherein the second drive identifier of the pluralityof drive identifiers is associated with a second drive, wherein thesecond drive is the least recently used drive associated with anidentifier of the plurality of drive identifiers that has not beeniterated over.
 12. The computer program product of claim 9, wherein theplurality of drives are iterated over based, at least in part, on howrecently each of the plurality of drives was used.
 13. The computerprogram product of claim 9, wherein the program instructions to beginiterating over the plurality of drive identifiers a first time comprisesprogram instructions to: sort the plurality of drive identifiers based,at least in part, on an the last use of each drive associated with eachof the plurality of drive identifiers; and select a first of theplurality of drive identifiers.
 14. The computer program product ofclaim 8, wherein a scratch storage medium is a tape cartridge and thefirst drive is a tape drive.
 15. An apparatus comprising: a processor;and a computer readable storage medium having program instructionsembodied therewith, the program instructions executable by the processorto cause the apparatus to, identify a first drive in a storage mediumlibrary, wherein the storage medium library comprises a plurality oflibrary strings; determine a first library string of the plurality oflibrary strings, wherein the first library string includes the firstdrive; determine whether a first storage medium is located within thefirst library string of the plurality of library strings; in response toa determination that the first storage medium is not located within thefirst library string of the plurality of library strings, identify asecond drive in the storage medium library; determine a second librarystring of the plurality of library strings, wherein the second librarystring of the plurality of library strings includes the second drive;determine whether a second storage medium is located within the secondlibrary string of the plurality of library strings; and in response to adetermination that the second storage medium is located within thesecond library string of the plurality of library strings, issue acommand to mount the second storage medium into the second drive. 16.The apparatus of claim 15, wherein the program instructions furthercomprise program instructions executable by the processor to cause theapparatus to: in response to a determination that a second storagemedium is not located within the second library string of the pluralityof library strings, identify a first set of one or more library stringsthat are coupled to the first library string; determine whether a thirdstorage medium is located in a library string of the first set of one ormore library strings; in response to a determination that a thirdstorage medium is located in a library string of the first set of one ormore library strings, issue a command to move the third storage mediumto the first library string and a command to mount the third storagemedium into the first drive; in response to a determination that a thirdstorage medium is not located in a library string of the first set ofone or more library strings, identify a second set of one or morelibrary strings that are coupled to the second library string; determinewhether a fourth storage medium is located in a library string of thesecond set of one or more library strings; and in response to adetermination that the fourth storage medium is located in a librarystring of the second set of one or more library strings, issue a commandto move the fourth storage medium to the second library string and acommand to mount the fourth storage medium into the second drive. 17.The apparatus of claim 15, wherein the program instructions beingexecutable by the processor to cause the apparatus to identify the firstdrive in the storage medium library comprises program instructionsexecutable by the processor to cause the apparatus to determine that thefirst drive is the least recently used drive of a plurality of drives.18. The apparatus of claim 17, wherein the program instructions beingexecutable by the processor to cause the apparatus to identify thesecond drive in the storage medium library comprises programinstructions executable by the processor to cause the apparatus todetermine that the second drive is the least recently used drive of theplurality of drives excluding the first drive.
 19. The apparatus ofclaim 17, wherein the first storage medium comprises a tape cartridgeand the storage medium library comprises a tape library.
 20. Theapparatus of claim 15, wherein the program instructions being executableby the processor to cause the apparatus to identify the first drive inthe storage medium library comprises program instructions executable bythe processor to cause the apparatus to: identify a plurality ofavailable drives; sort a list of the plurality of available drivesbased, at least in part, on how recently each of the plurality ofavailable drives was used; and select the first drive from the list ofthe plurality of available drives.